home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Utilities
/
Workspace
/
WrapperInspector
/
Source
/
SoundSubInspector.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
3KB
|
104 lines
//----------------------------------------------------------------------------------------------------
//
// SoundSubInspector
//
// Inherits From: DefaultSubInspector
//
// Declared In: SoundSubInspector.h
//
// Disclaimer
//
// You may freely copy, distribute and reuse this software and its
// associated documentation. I disclaim any warranty of any kind,
// expressed or implied, as to its fitness for any particular use.
//
//----------------------------------------------------------------------------------------------------
#import "SoundSubInspector.h"
#import <appkit/appkit.h>
@implementation SoundSubInspector
static id _SELF = nil;
//----------------------------------------------------------------------------------------------------
// Initialization and Free Methods
//----------------------------------------------------------------------------------------------------
+ new
{
// Only allow one instance...
if (_SELF) return _SELF;
_SELF = self = [super new];
sound = [[Sound alloc] init];
return _SELF;
}
- free
{
if (sound) [sound free];
return [super free];
}
//----------------------------------------------------------------------------------------------------
// Inspection Methods
//----------------------------------------------------------------------------------------------------
- inspect: (STR) path
{
// Read the soundfile and display information...
int readStatus;
if (! path) return self;
readStatus = [sound readSoundfile: path];
if (readStatus != SND_ERR_NONE)
{
[sound deleteSamples];
return [self inspectionError: path];
}
[size setIntValue: [sound dataSize]];
[samples setIntValue: [sound sampleCount]];
[seconds setFloatValue: [sound duration]];
[format setIntValue: [sound dataFormat]];
[rate setDoubleValue: [sound samplingRate]];
[channels setIntValue: [sound channelCount]];
[info setStringValue: [sound info]];
return self;
}
//----------------------------------------------------------------------------------------------------
// Action Methods
//----------------------------------------------------------------------------------------------------
- play: sender
{
[sound play];
return self;
}
//----------------------------------------------------------------------------------------------------
// Accessing Inspection View
//----------------------------------------------------------------------------------------------------
- clearInspectorView
{
// Clear view before...
[size setStringValue: ""];
[samples setStringValue: ""];
[seconds setStringValue: ""];
[format setStringValue: ""];
[rate setStringValue: ""];
[channels setStringValue: ""];
[info setStringValue: ""];
return self;
}
@end